package com.cxwx.restful.controller;

import com.cxwx.restful.entity.UserInfo;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/user")
public class RestFulController {

    @PostMapping
    public String addUser(@RequestBody UserInfo userInfo) {
        System.out.println(userInfo);
        return "新增用户成功";
    }

    @DeleteMapping("/{id}")
    public String del(@PathVariable Integer id) {
        System.out.println("del 用户id" + id);
        return "删除成功";
    }

    @PutMapping
    public String edit(@RequestBody UserInfo userInfo) {
        System.out.println("修改成功");
        return "修改成功";
    }
    @GetMapping("/{id}")
    public String getById(@PathVariable Integer id) {
        System.out.println("查询单个"+id);
        return "查询单个";
    }
    @GetMapping()
    public String get() {
        System.out.println("查询所有用户");
        return "查询所有用户";
    }

}
